package com.yanqu.road.logic.activity.foxcard.game.effect;

import com.yanqu.road.entity.activity.foxcard.FoxBaseCard;
import com.yanqu.road.entity.activity.foxcard.FoxHandCard;
import com.yanqu.road.logic.activity.foxcard.game.*;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * 打出的人头牌改变为指定增强效果
 * buffid|0|0|0|0
 */
public class FoxCardEffect22 extends FoxCardEffectBase {
    @Override
    public void effectHandle(FoxCardGameLogic gameLogic, FoxHandCard handCard) {
        if (triggerType == eFoxCardTriggerType.BEFORE_SCORE) {
            int reinforceEffect = Integer.valueOf(effectConfig.getParamsList().get(0));
            List<FoxBaseCard> settleCards = Collections.singletonList(effectCard);
            List<FoxBaseCard> triggerCards = new ArrayList<>();
            for (FoxHandCard showCard : gameLogic.getShowHandCards()) {
                if (gameLogic.isHeardHandCard(showCard)) {
                    showCard.setReinforceEffect(reinforceEffect);
                    triggerCards.add(showCard);
                }
            }
            if (!triggerCards.isEmpty()) {
                FoxCardShowInfo showInfo = gameLogic.newFoxShow(eFoxCardShowType.REINFORCE_EFFECT.getValue());
                showInfo.setSettleCards(settleCards);
                showInfo.setTriggerCards(triggerCards);
                showInfo.setShowValue(reinforceEffect);
            }
        }
    }
}
